I know from an AWS API call (similar to aws rds describe-db-instances --db-instance-identifier instanceIdentifier) that my AWS RDS Postgres instance has dbInstanceClass equal to "db.t2.large".
Using another API call, I want to get the attributes of a "db.t2.large" instance class especially the allocated memory.
I can get the value from the AWS documentation but I want the value programmatically.
What would be the API call or the equivalent on the command line?
An RDS instance is some kind of specialized EC2 instance but I did not find anything either under the EC2 API.
Thanks
Olivier
From other people, I got the answer that there is no API for this. You have to rely on screen scraping...
Outside of the AWS documentation page, this web site http://www.ec2instances.info/rds gives the values for EC2 and RDS and you can download all the values or specific columns as a CSV file.
Related
As of the date of this question I'm using the most recent version of the AWS CLI (2.4.6) running on macOS. According to the v2 docs the Instances that are returned should include properties like InstanceLifecycle, Licenses, MetadataOptions -> PlatformDetails and several others that are missing for me. While I'm getting back most data, some fields are absent... I've tried this is two separate AWS accounts and I have admin IAM creds that I'm using locally, why does the aws ec2 describe-instances call not return all of the fields listed in the docs?
Not all outputs is available for every ec2 instance, it depends on the way of provisioning of your ec2 instances.
Ex:
InstanceLifecycle: is exclusive if you provisioned the ec2 instance as spot instance or reserved one.
Licenses: If you used BYOL when provisioning EC2 (Bring your own license)
Extra.. The docs describe every possible output from querying ec2 api endpoint, but it depends on the different parameters of your provisioned ec2 instance.
For example, try to provision a spot instance, and query the instance lifecycle.
I want to securely fetch configuration files from S3 using a secure VPC from my Docker container. But I want to determine inside the application which configuration file to fetch and use based on the region I am on. Is there a good/best practice to go on about describing the current container's region?
I understand that you can use the AWS SDK/CLI to describe the ECS instances, but that doesn't tell me which one the container is specifically deployed on.
Use the metadata server to query the availability-zone from which you can get the region.
$ curl 169.254.169.254/latest/meta-data/placement/availability-zone/
us-east-1a
One example if you are using python SDK is:
import os
az = os.popen("curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone/").read()
print az[:-1]
>>> us-east-1
Within EC2, you can retrieve the instance metadata using a simple curl command to a local (internal) web API. Region and AZ are some of the data points you can get:
http://169.254.169.254/latest/meta-data/services/domain
http://169.254.169.254/latest/meta-data/placement/availability-zone
See this page for full details about instance metadata.
Within ECS, I'd be interested to see if these might still work -- my hunch is they would, as the container should query the host machine's API for the answer, and the ECS host is most certainly an EC2 instance.
Let us know if that works?
I'm trying to insert records into a Postgres database in RDS from a Lambda function. My Node.js lambda function works correctly when run locally, but the database connection times out when run in AWS.
I've read several articles and tutorials which suggest that AWS Lambda functions cannot access RDS instances that are within a VPC. For example: http://ashiina.github.io/2015/01/amazon-lambda-first-impression/
Unfortunately; it seems I am unable to create an RDS instance that exists outside of a VPC. At this dropdown I would expect to be able to select an option for "No VPC" or something along those lines.
Has this option been removed? Perhaps I have missed a step?
You can create a publicly accessible RDS instance. Then you should be able to access it from anywhere, inside or outside AWS. I believe that would get around your issue with Lambda. You are asked if the instances needs to be publicly accessible when you create a new RDS instance via the web console.
Or you could just wait a few weeks, as Lambda within a VPC is supposed to be enabled "later this year".
Edit: Note that newer Amazon accounts are restricted to VPC only resources. You can't create EC2 or RDS instances outside of a VPC anymore. That's why you don't see the "No VPC" option anymore.
Second Edit: VPC access for Lambda functions is now genearally available.
This question is awhile back, but for those of you who are using MySQL, now you can connect AWS Lambda with Aurora Serverless without VPC, utilizing their new Data API. Take a look at this example for details https://coderecipe.ai/architectures/77374273
I would like to know how to get a list of the EC2 Instances available in AWS making a JSON/XML Request or using any API of AWS.
Case:
"I want to display in my app the EC2 Instances available in AWS and also use this data to suggest an EC2 Instances"
Any idea?
Thanks!
UPDATE 1
The list of EC2 Instances that i would like to display and use is the one that appears in : http://aws.amazon.com/ec2/instance-types/
Is there some way to get the EC2 instance type details via an API? That is, I'd like to list the various types like 't1.micro', 'c3.xlarge', 'm3.xlarge', and see how much memory they have, local disk space, vCPU, ECU, etc.
This is now possible via aws ec2 describe-instance-types (AWS CLI v2.1.16), or the DescribeInstanceTypes EC2 API.