Launch EC2 Instance #37
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Launch EC2 Instance | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| stack_name: | |
| description: "Stack Name" | |
| required: true | |
| instance_type: | |
| description: "EC2 Instance Type" | |
| required: true | |
| default: "t2.micro" | |
| ami_id: | |
| description: "AMI ID" | |
| required: true | |
| default: "ami-0b20f552f63953f0e" | |
| availability_zone: | |
| description: "Availability Zone" | |
| required: true | |
| default: "ap-northeast-1c" | |
| key_name: | |
| description: "EC2 KeyPair Name" | |
| required: true | |
| default: "deploy_key" | |
| instance_name: | |
| description: "Instance Name" | |
| required: true | |
| default: "coseeing-instance" | |
| disk_size: | |
| description: "Root Volume Size (GB)" | |
| required: true | |
| default: "8" | |
| rds_name: | |
| description: "RDS Instance Name" | |
| required: false | |
| default: "coseeing-main" | |
| rds_endpoint: | |
| description: "RDS Endpoint" | |
| required: false | |
| default: "coseeing-main.c36wy6akucw9.ap-northeast-1.rds.amazonaws.com" | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| launch: | |
| name: launch ec2 instance | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_GITHUB_ACTION_ROLE }} | |
| aws-region: ap-northeast-1 | |
| - name: Deploy CloudFormation stack | |
| uses: aws-actions/aws-cloudformation-github-deploy@v1 | |
| with: | |
| name: ${{github.event.inputs.stack_name}} | |
| template: cloudformation/common-ec2-instance-template.yml | |
| parameter-overrides: >- | |
| InstanceType=${{ github.event.inputs.instance_type }}, | |
| AmiId=${{ github.event.inputs.ami_id }}, | |
| AvailabilityZone=${{ github.event.inputs.availability_zone }}, | |
| KeyName=${{ github.event.inputs.key_name }}, | |
| InstanceName=${{ github.event.inputs.instance_name }}, | |
| SecurityGroups="sg-098baa9d7eaf501a8,sg-0d260cbf1556be14b,sg-09786ad8171652b3b", | |
| DiskSize=${{ github.event.inputs.disk_size }}, | |
| PrivateRouteTableId="rtb-00ab52d37d56d1b4b", | |
| RdsName=${{ github.event.inputs.rds_name }}, | |
| RdsEndpoint=${{ github.event.inputs.rds_endpoint }} | |
| no-fail-on-empty-changeset: "1" |