A script in bash that parse the Atlassian IP address ranges (https://ip-ranges.atlassian.com) and add them to aws' default security group
Build the image then run it
docker build -t sgupdate .
docker run --env aws_access_key_id=${aws_access_key_id} \
--env default_secret_key=${default_secret_key} \
--env default_region=${default_region:-us-east-1} \
--env default_format=${default_format:-json} \
-it sgupdate
- Create an ECR repository. Run
aws ecr create-repository --repository-name sgupdate --image-scanning-configuration scanOnPush=t
- Build and push the image to aws' ECR. Run build_and_push.sh to achieve that. You need to export the following variables first.
- export aws_access_key_id = "Your access key id"
- export default_region = "us-east-1"
- Create an IAM policy that allow ec2:AuthorizeSecurityGroupIngress
- Create an AWS lambda execution role, attach the policy created in step 3 to it
- Create an AWS lambda to run an image. use the URI of your newly pushed image ( in step 2 )
- Use the execution role created in step 4 as the execution role of your newly created Lambda function
- Invoke the Lambda function
I have documented the script with comments