Chaning AMI and apply it to ASG for refresh old instacnes automatically, once I deploy

0

Hello, recently, I use Windows 2019 of EC2 instances and using launchconfigurations for AutoScaling.

I used own tool for deploy for ec2.

Is there anyway I can make AMI and apply to ASG and also exchanging old ec2 to new AMI image automatically?

I thought I could use 2 lambda to make it happend, but it didnt go well.

My scnerio is

deploy app -> API gateway -> lambda 1 ( making AMI) -> when the status chaged to 'available' -> trigger lambda 2 -> changing AMI image of ASG and refresh.

anyone have experience of this?

Heesu
질문됨 일 년 전1508회 조회
2개 답변
0

The way I've commonly seen it done is as follows.

ASG resources are defined in CloudFormation with rolling update of instances, and the template has an "AMI" parameter set to the ID of your custom AMI. When you want to update it to a new AMI ID, run a CloudFormation Stack update with the new value for the AMI parameter. You could trigger the Stack update as soon as your new AMI is available, or have something scheduled that regularly checks for new AMIs for Stacks that have an "AMI" parameter, for example.

BTW Launch Configurations are being deprecated, so best to update to using Launch Templates.

전문가
답변함 일 년 전
  • Thank you for comment. first of all I know Launch Configuration will be deprecated but it will support until I have it, so I won't change yet.

    and you told me that I can use run cloudformation Stack update. However, I want to do all the process automatically.

    is it possible using cloudformation stack update as automation?

0

Does this automation template work for you? It uses launch templates instead of launch configs, but otherwise it sounds like what you're asking for: https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-walk-patch-windows-ami-autoscaling.html

AWS
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠