Launching a Bottlerocket instance for Amazon ECS
You can launch a Bottlerocket instance so that you can run your container workloads.
You can use the AWS CLI to launch the Bottlerocket instance.
Create a file that's called
userdata.toml. This file is used for the instance user data. Replacecluster-namewith the name of your cluster.[settings.ecs] cluster = "cluster-name"Use one of the commands that are included in Retrieving Amazon ECS-optimized Bottlerocket AMI metadata to get the Bottlerocket AMI ID. You use this in the following step.
Run the following command to launch the Bottlerocket instance. Remember to replace the following parameters:
-
Replace
subnetwith the ID of the private or public subnet that your instance will launch in. -
Replace
bottlerocket_amiwith the AMI ID from the previous step. -
Replace
t3.largewith the instance type that you want to use. -
Replace
regionwith the Region code.
aws ec2 run-instances --key-name ecs-bottlerocket-example \ --subnet-idsubnet\ --image-idbottlerocket_ami\ --instance-typet3.large\ --regionregion\ --tag-specifications 'ResourceType=instance,Tags=[{Key=bottlerocket,Value=example}]' \ --user-data file://userdata.toml \ --iam-instance-profile Name=ecsInstanceRole-
-
Run the following command to verify that the container instance is registered to the cluster. When you run this command, remember to replace the following parameters:
-
Replace
clusterwith your cluster name. -
Replace
regionwith your Region code.
aws ecs list-container-instances --clustercluster-name--regionregion -
For a detailed walkthrough of how to get started with the Bottlerocket
operating system on Amazon ECS, see Using a Bottlerocket AMI with Amazon ECS