Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Silence of the Lambda - Use AWS Lambda & Python to automate operating system updates on AMI - TerraAlto

534 views

Published on

Using AWS Lambda & Python Boto3 library to automate operating system updates to AMIs (Windows and Linux). AWS User Group talk by TerraAlto in March 2016.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Silence of the Lambda - Use AWS Lambda & Python to automate operating system updates on AMI - TerraAlto

  1. 1. The Silence of the Lambda Automate Windows AMI updates to stop the screaming
  2. 2. Why automate AMI updates? • Security • Consistency • Cost
  3. 3. Stage 1– Identify AMIs (to update)
  4. 4. Tagging with “AutoUpdate = yes” Stage 1 Technical Detail: Identify AMIs
  5. 5. Stage 1 – Identify AMIs( Completed)
  6. 6. Stage 2 – Update AMIs Step 1: Launch EC2 Instances
  7. 7. Stage 2 – Update AMIs WSUS Server Step 2: Run Update on EC2 Instances
  8. 8. Step 3: Create Updated AMIs Stage 2 – Update AMIs
  9. 9. Step 1 – Launch EC2 Instance resource.create_instances(ImageId=ami_id, … ) Stage 2 Technical Detail: Update AMI
  10. 10. Step 2 – Update EC2 Instance params = { "commands":["wuauclt.exe ..."], "workingDirectory":["C:WindowsSystem32"], } ssm_client.send_command ( instance_id, params, ... ) Stage 2 Technical Detail: Update AMI
  11. 11. Step 3 – Create Updated AMI ami = client.create_image( DryRun=False, InstanceId=instance_id, Description='Automated AMI creator', Name="{0}- {1}".format(name,int(time.time()))) Stage 2 Technical Detail: Update AMI
  12. 12. Appendix : 2 Lambda Functions linked via S3 Bucket Stage 2 Technical Detail: Update AMI Lambda Function BLambda Function A Find AMI Launch EC2A Run UpdateB Log update in S3 fileC D HousekeepingStage 1 Stage 2 Stage 3 Stage 2
  13. 13. Appendix : S3 Bucket Configuration Stage 2 Technical Detail: Update AMI
  14. 14. Appendix – S3 Bucket Call OutputS3BucketName='fc-automation', OutputS3KeyPrefix="windowsupdates-{0}-{1}- ".format(instance_id, ami_id)) Stage 2 Technical Detail: Update AMI
  15. 15. Appendix : S3 Bucket Updates Stage 2 Technical Detail: Update AMI
  16. 16. Stage 2 –Update AMIs ( Complete)
  17. 17. Stage 3 – Housekeeping Step 1: De-register Earlier Version AMIs
  18. 18. Stage 3 – Housekeeping Step 2: Terminate EC2 Instances
  19. 19. Deregister Earlier AMIs & Terminate EC2 Instances Stage 3 Technical Detail: Housekeeping client.deregister_image(ImageId=ami_id) client.terminate_instances(InstanceIds=[instance_id])
  20. 20. Outcome: Updated AMIs Stage 3 Technical Detail: Housekeeping
  21. 21. Stage 3 – Housekeeping ( Complete)
  22. 22. Stage 1 Identify AMIs Stage 2 Update AMIs Stage 3 Housekeeping Automated AMI Update ( Complete)
  23. 23. Contact Details jobs@terraalto.com www.terraalto.com

×