Change Lightsail's public IP using boto3 APIs.
- deploy a lightsail instance somewhere with a name
<instance_name>
- host domain zone in Route53 and get
<hosted_zone_id>
- create an IAM account with Route53 fullaccess and lightsail privileges:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "lightsail:GetInstances", "lightsail:GetStaticIps", "lightsail:AttachStaticIp", "lightsail:GetStaticIp", "lightsail:ReleaseStaticIp", "lightsail:GetInstance", "lightsail:DetachStaticIp", "lightsail:AllocateStaticIp" ], "Resource": "*" } ] }
- get IAM token and set it with
aws configure
command - add
local_settings.py
in project rootSECRET_KEY = 'xxx' # secret_key used by flask SESAME_OPENS = 'xxx' # the secret code inputed before pressing Sesame Opens button HOSTED_ZONE_ID = <hosted_zone_id> RECORD_SET_NAME = <full_domain_name> INSTANCE_NAME = <instance_name> IP_NAME_PREFIX = <ip_name_prefix> # prefix that identify static ips allocated by the project.
python app.py
or run from gunicorn
MIT