ElasticBeanstalk Single Instance Environment not Getting Assigned Elastic IP

0

Hello AWS Community,

I hope you're all doing well. I'm currently facing an issue with creating a Single Instance ElasticBeanstalk environment. I have a script and an ebextensions file (details provided below) to create this environment, but it seems that no Elastic IP address is assigned when I use the script. However, when I rebuild the environment through the AWS Management Console UI, an Elastic IP is successfully assigned. I'm wondering why this difference in behavior occurs.

Here is my script for creating the ElasticBeanstalk environment:

script:
  - aws elasticbeanstalk check-dns-availability --cname-prefix $AWS_BEANSTALK_ENVIRONMENT_DOMAIN
  - aws elasticbeanstalk create-environment --cname-prefix $AWS_BEANSTALK_ENVIRONMENT_DOMAIN --application-name $AWS_BEANSTALK_APPLICATION_NAME  --version-label $AWS_BEANSTALK_VERSION --environment-name $AWS_BEANSTALK_ENVIRONMENT_FULLNAME --solution-stack-name "$AWS_ENVIRONMENT_SOLUTION_STACK"

And here is my ebextensions file:

option_settings:
    - namespace: aws:elasticbeanstalk:sns:topics
      option_name: Notification Endpoint
      value: xx@gmail.com
    - namespace: aws:ec2:instances
      option_name: SpotFleetOnDemandAboveBasePercentage
      value: 0
    - namespace: aws:ec2:instances
      option_name: InstanceTypes
      value: t4g.micro
    - namespace: aws:ec2:instances
      option_name: SupportedArchitectures
      value: arm64
    - namespace: aws:elasticbeanstalk:cloudwatch:logs
      option_name: DeleteOnTerminate
      value: true
    - namespace: aws:elasticbeanstalk:cloudwatch:logs
      option_name: StreamLogs
      value: true
    - namespace: aws:elasticbeanstalk:environment
      option_name: ServiceRole
      value: arn:aws:iam::xxxx:role/service-role/aws-elasticbeanstalk-service-role
    - namespace: aws:elasticbeanstalk:environment
      option_name: EnvironmentType
      value: SingleInstance
    - namespace: aws:ec2:vpc
      option_name: VPCId
      value: vpc-aaa
    - namespace: aws:ec2:vpc
      option_name: Subnets
      value: subnet-xx,subnet-yy,subnet-zz
    - namespace: aws:ec2:vpc
      option_name: AssociatePublicIpAddress
      value: true
    - namespace: aws:elasticbeanstalk:healthreporting:system
      option_name: ConfigDocument
      value: {
              "Version": 1,
              "CloudWatchMetrics": {
                "Instance": {},
                "Environment": {}
              },
              "Rules": {
                "Environment": {
                  "ELB": {
                    "ELBRequests4xx": {
                      "Enabled": true
                    }
                  },
                  "Application": {
                    "ApplicationRequests4xx": {
                      "Enabled": true
                    }
                  }
                }
              }
            }
    - namespace: aws:autoscaling:launchconfiguration
      option_name: EC2KeyName
      value: mypair
    - namespace: aws:autoscaling:launchconfiguration
      option_name: IamInstanceProfile
      value: aws-elasticbeanstalk-ec2-role
    - namespace: aws:autoscaling:launchconfiguration
      option_name: SecurityGroups
      value: sg-xxxx
    - namespace: aws:elasticbeanstalk:managedactions
      option_name: ManagedActionsEnabled
      value: true
    - namespace: aws:elasticbeanstalk:managedactions
      option_name: PreferredStartTime
      value: Sun:09:00
    - namespace: aws:elasticbeanstalk:managedactions:platformupdate
      option_name: UpdateLevel
      value: minor
    - namespace: aws:autoscaling:asg
      option_name: MinSize
      value: '1'
    - namespace: aws:autoscaling:asg
      option_name: MaxSize
      value: '1'

According to the AWS documentation, it states that Single Instance environments should automatically be assigned an Elastic IP address. The specific documentation can be found here under the "AssociatePublicIpAddress" option:

"This option has no effect on a single-instance environment, which always has a single Amazon EC2 instance with an Elastic IP address. The option is relevant to load-balanced, scalable environments."

Despite this documentation, I am not seeing the Elastic IP address assigned when using my script.

Could anyone provide insights into why this behavior might be occurring? I would greatly appreciate any assistance or suggestions to resolve this issue.

Thank you in advance for your help!

cadoad
asked 7 months ago61 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions