Skip to content

Instantly share code, notes, and snippets.

@toricls
Created August 4, 2021 12:54
Show Gist options
  • Save toricls/d45aa722e301510b82022b891be3cdb2 to your computer and use it in GitHub Desktop.
Save toricls/d45aa722e301510b82022b891be3cdb2 to your computer and use it in GitHub Desktop.
Copilot で App Runner サービスをデプロイしたいだけなのに `env init` で VPC が作られて悲しいので、とりあえず default VPC で無理矢理 `env init` を通してしまう図
$ defaultVpcId=$(aws ec2 describe-vpcs --region "${AWS_REGION}" \
--filter Name=isDefault,Values=true | jq -r '.Vpcs[0].VpcId')
$ subnetIds=$(aws ec2 describe-subnets --region "${AWS_REGION}" \
--filter Name=vpc-id,Values="${defaultVpcId}" \
| jq -r '.Subnets | map (.SubnetId) | join(",")')
$ copilot env init \
--name ops --profile "${AWS_PROFILE}" --region "${AWS_REGION}" \
--import-vpc-id "${defaultVpcId}" --import-private-subnets "${subnetIds}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment