When I create a new environment in AWS Beanstalk using its Java API, I pass the application name and the new environment name in a CreateEnvironmentRequest to the createEnvironment method.
After the environment is created the URL is something like my-environment-name-wixmmatir2.elastsicbeanstalk.com. But I don't know where the "wixmmatir2" comes from. It seems to be a string with random characters that Beanstalk adds to my URL.
Does anyone know why this happens?
Is there a way to force Beanstalk to respect the name I gave?
I need a predictable URL, such as my-environment-name.elastsicbeanstalk.com, without random characters being added to it.
To create environment with a specific URL you should set CNAME prefix on CreateEnvironmentRequest:
public void setCNAMEPrefix(String cNAMEPrefix)
JavaDoc for the method:
If specified, the environment attempts to use this value as the prefix for the CNAME. If not specified, the CNAME is generated automatically by appending a random alphanumeric string to the environment name.
Another helpful method to check if the specified CNAME is available:
CheckDNSAvailabilityResult checkDNSAvailability(CheckDNSAvailabilityRequest checkDNSAvailabilityRequest)
throws AmazonServiceException, AmazonClientException
Related
I'm working on automating access to some APIs thru a visual interface and thus would like to present the user with a user-friendly interface to call Amazon AWS APIs.
However the documentation uses human-readable formats but then the API need be called using more compact tokens.
I'd like to have a list of all the services, ideally:
ServiceID, Service name, Action Firendly Name, Action/Operation name, command line name
e.g. looking into CloudFront ListDistributions operation we can see that:
Service is called "CloudFront" but the API endpoint is spelled lowercase "cloudfront"
API requires calling GET /< version>/distribution (see https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_ListDistributions.html )
Commandline requires using the "list-distributions" form: https://docs.aws.amazon.com/cli/latest/reference/cloudfront/list-distributions.html
similar thing with "ListPublicKeys" https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_ListPublicKeys.html
Thus a table like this would help:
ServiceID, Service name, Action Firendly Name, Action/Operation name, command line name
cloudfront, CloudFront, ListDistributions, distribution, list-distributions
cloudfront, CloudFront, ListPublicKeys, public-key, list-public-keys
The link posted from #John Rotenstein in the comment resolves the issue.
The data files from Boto core contain enought information to build the above mentioned table.
So I have been trying to create an Ansible playbook which creates a new instance to GCP and create a test file inside that instance. I've been using this example project from Github as template. In this example project, there is ansible_hosts -file which contains this host:
[gce_instances]
myinstance[1:4]
but I don't have any idea what it is doing actually?
The fragment your provided is Ansible technology and not actually related to anything GCP specific. This is a good reference doc: Working with Inventory.
At a high level,
[gce_instances]
myinstance[1:4]
the hosts file defines the machine identities against which Ansible is to execute against. With the hosts file, you can define groups of hosts to allow you to apply ansible playbooks to subsets of hosts at a time.
In the example, a group is created that is called gce_instances. There is nothing special or magic about the name. It isn't any kind of key word/phrase special to our story.
Within a group, we specify the hostnames that we wish to work against.
The example given is a wild-card specifier and simply short-hand for:
[gce_instances]
myinstance1
myinstance2
myinstance3
myinstance4
I am new to amazon Route53. As of now, I am able to create a hosted zone and a resource record set in my amazon account. But now I want to search whether a record set already exists in my hosted zone. For Example
Hosted zone "abc.com" and it has two-record set in it.
A.abc.com
B.abc.com
Now I want to query my hosted zone and find out whether A.abc.com already exists in the abc.com.
So, is there any API that I can use where I can pass my amazon credentials and my amazon hostedzone and the searched "record set" and then I can get the result back whether that record set already exists. Kindly guide me.
After research, I found out that there is "ListResourceRecordSet" which will give me the list back for a particular zone. But I don't want the list I just want to check whether the entry already exists.
I have been able to perform this check efficiently using the ListResourceRecordSet API method, and the name and maxitems parameters. You haven't specified how you are accessing the API, so I'm going to explain this using the standard AWS REST API.
Given your example:
Call the API passing A.abc.com as the name parameter and 1 as the maxitems parameter. Your request will look like this: https://route53.amazonaws.com/2013-04-01/hostedzone/{YOUR_HOSTED_ZONE_ID}/rrset?name=A.abc.com.&maxitems=1
Note that I've added a trailing dot (".") to the end of the resource name A.abc.com. The API reference indicates that it may affect result sort order so I add it just in case.
You will get back an XML result in this format:
<?xml version="1.0"?>
<ListResourceRecordSetsResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
<ResourceRecordSets>
<ResourceRecordSet>
<Name>A.abc.com.</Name>
<Type>A</Type>
<TTL>3600</TTL>
<ResourceRecords>
<ResourceRecord>
<Value>SOME_IP_ADDRESS</Value>
</ResourceRecord>
</ResourceRecords>
</ResourceRecordSet>
</ResourceRecordSets>
<IsTruncated>true</IsTruncated>
<NextRecordName>B.abc.com.</NextRecordName>
<NextRecordType>A</NextRecordType>
<MaxItems>1</MaxItems>
</ListResourceRecordSetsResponse>
Now you're going to have to do some parsing. Check the result to see if there is one ResourceRecordSet and if its Name property matches the name of the resource record you are looking for (you probably want to do a case-insensitive compare of the two values). Keep in mind that the Name property has that trailing period (".") at the end, so add it to the name you're searching for before doing the comparison.
If there is exactly one resource record set and the name matches the one you are looking for, it exists. If either one of those checks fails, then it does not exist.
Granted, this isn't as simple as a GetResourceRecordSet operation would be, but at least it keeps you from having to query the entire zone and parse a bunch of records. You also won't run into the long delay or throttling issues that you may using the CLI --query option.
There does not appear to be a way to use this method with the AWS CLI as it lacks a --name parameter for some reason. I can vouch for the fact that the JavaScript SDK will allow you to do this using the StartRecordName parameter.
There is no way to filter the API call, but there is a way to filter the data returned. Using the CLI you can do this with the --query option.
From the documentation: "To view all the resource record sets of a particular name, use the --query parameter to filter them out. For example:"
aws route53 list-resource-record-sets --hosted-zone-id Z2LD58HEXAMPLE --query "ResourceRecordSets[?Name == 'A.abc.com']"
I'm trying to set a logging pattern using 'logging.pattern.console' that needs to include the CloudFoundry's application name of a given application. I know that application names can be found as part of the VCAP_APPLICATION env variable with the 'application_name' key, and I can resolve env variables on Spring Cloud applications using the standard Spring placeholder notation, available on the application.yml file; but as the variable is a Json, I can't parse it nor use SpEL to obtain the requested value only.
Is there any other way to obtain the application name as set on the manifest.yml file in the application.yml?
If you are using Spring Boot, you can access the application name with the property vcap.application.name. You should be able to reference this anywhere that properties are available, like #Value annotations or in application.properties.
Spring Boot's CloudFoundryVcapEnvironmentPostProcessor takes the VCAP_SERVICES & VCAP_APPLICATION environment variables and makes them available as properties through Spring's Environment api. This should happen automatically, no config or work necessary.
What I wanted to achieve is pretty simple, if you send a request to some address, the response you get is a single integer number, like 13 for example. I think it is equivalent to hosting a .html page with single number on that page and then I can parse that string in my application. (It is a Unity game, using the WWW class to send the request.)
(This is actually a version number. If it is greater than what I stored in my app I would update it and then send another request to other place and retrieve something bigger)
I am looking for the cheapest way that can handle this. I planned to use AWS but confused what component should be use? S3? EC2? Lambda? CloudFront?
If you think doing this on a web hosting or Heroku or something else is better, I also wanted to hear about it.
To serve up a simple value, S3 should do the trick.
Create a bucket in the console, using lonely lowercase letters, digits, and dashes in the name. The name has to be globally unique among all of S3, so make up something unique. We'll call the bucket name example-bucket.
Create your file on your computer with the desired contents. If plain text, call it version.txt.
In the AWS console, select the bucket, and upload the file. While clicking through the "next" screens, put a check next to "make everything public" and accept the defaults. Upload the file.
Now, go to https://example-bucket.s3.amazonaws.com/version.txt in your browser and verify (using your actual bucket name. That's your download link.
Done. As long as you don't expect to handle over about 800 requests per second, this will do exactly what you want.
Review the S3 pricing, of course.
Although this question is suitable for Server Fault,
EC2 using nginx or apache web server will be sufficient.
Put Load balancer in front of EC2 instances.