Posted On March 31, 2019

AWS Autoscale with Public IP re-association

kimconnect 0 comments
blog.KimConnect.com >> Virtualization >> AWS Autoscale with Public IP re-association
Option 1:
--associate-public-ip-address command option with the as-create-launch-config command

Option 2:
Allocate an Elastic IP then adding a startup script in the Create Launch Configuration -> Configure Details -> Advanced Details -> User data:
--------------------------------------
#!/bin/bash

# configure AWS
aws configure set aws_access_key_id $accessKey
aws configure set aws_secret_access_key $secretAccessKey
aws configure set region {MY_REGION}

# associate Elastic IP
INSTANCE_ID=$(curl -s
ALLOCATION_ID={MY_EIP_ALLOC_ID}
aws ec2 associate-address --instance-id $INSTANCE_ID --allocation-id $ALLOCATION_ID --allow-reassociation
----------------------------------------

Example (SMTP01)
--------------------------------------
#!/bin/bash

# configure AWS
aws configure set aws_access_key_id $accessKey
aws configure set aws_secret_access_key $secretAccessKey
aws configure set region us-west-1b

# associate Elastic IP
INSTANCE_ID=$(curl -s
ALLOCATION_ID=i-80b45e42
aws ec2 associate-address --instance-id $INSTANCE_ID --allocation-id $ALLOCATION_ID --allow-reassociation

----------------------------------------

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Virtual Machine Manager Error ID 23351 FirstBootDevice Invalid

When moving, importing, exporting Generation 2 template in VMM, the following error occurs when trying…

Overview of Veeam Backup and Restore

Prepare the Environment Permissions - Active Directory: create a service account as a member of…

PowerShell: Connect to Azure CLI

# Set PSGallery as trusted to bypass promptsSet-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted -WarningAction SilentlyContinue #…