Reputation: 1200
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.
Upvotes: 0
Views: 152
Reputation: 10601
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
Upvotes: 1