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

Kubernetes Ingress Error 502 Upon NextCloud Upgrades

Issue: Just the other day, I've attempted to run a 'helm upgrade…' command on my…

How to Clone VMWare Virtual Machine using CLI

1. SSH into the ESXi host to perform VM cloning via Command Line Interface (CLI)…

Overview of Microsoft Azure Networking

Private connections into Azure are either via ExpressRoute (comparable to AWS DirectConnect) or VPN. The…