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

PowerShell: Get All Hyper-V Host Spectre Patch Versions

# getAllVmSpectrePatchVersions.ps1 function getHyperVHostsInForest{ function includeRSAT{ $ErrorActionPreference='stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #$rsatWindows7x32='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x86-RefreshPkg.msu' $rsatWindows7x64='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x64-RefreshPkg.msu' $rsatWindows81='https://download.microsoft.com/download/1/8/E/18EA4843-C596-4542-9236-DE46F780806E/Windows8.1-KB2693643-x64.msu' $rsat1709 =…

Setup Virtual DMZ and Trust Zones with PFSense

I. Setup Route at Core Router1. Configure subnet, ip helper address, and default route---------- Example…

Installing VMWare Tools on Linux Guest Virtual Machines

Installation Process # Installing VMWare Tools mkdir /mnt/cdrom mount /dev/cdrom /mnt/cdrom cp /mnt/cdrom/VMwareTools-*.tar.gz /tmp/ cd…