Skip to content

Commit a6c546b

Browse files
committed
(doc) adding an example and explanation
1 parent 4c1bd09 commit a6c546b

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

README.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Deploys AWS CloudFormation Stacks.
1616
parameter-overrides: "MyParam1=myValue,MyParam2=${{ secrets.MY_SECRET_VALUE }}"
1717
```
1818
19-
The action can be passed a CloudFormation Stack `name` and a `template` file. It will create the Stack if it does not exist, or create a [Change Set](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-changesets.html) to update the Stack. An update fails by default when the Change Set is empty. Setting `no-fail-on-empty-changeset: "1"` will override this behavior and not throw an error.
19+
The action can be passed a CloudFormation Stack `name` and a `template` file. The `template` file can be a local file existing in the working directory, or a URL to template that exists in an [Amazon S3](https://aws.amazon.com/s3/) bucket. It will create the Stack if it does not exist, or create a [Change Set](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-changesets.html) to update the Stack. An update fails by default when the Change Set is empty. Setting `no-fail-on-empty-changeset: "1"` will override this behavior and not throw an error.
2020

2121
See [action.yml](action.yml) for the full documentation for this action's inputs and outputs.
2222

@@ -63,6 +63,67 @@ This action requires the following minimum set of permissions:
6363
6464
> The policy above prevents the stack to be deleted by a policy for production
6565
66+
## Example
67+
68+
You want to run your microservices with [Amazon Elastic Kubernetes Services](https://aws.amazon.com/eks/) and leverage the best-practices to run the cluster? Using this GitHub Action you can customize and deploy the [modular and scalable Amazon EKS architecture](https://aws.amazon.com/quickstart/architecture/amazon-eks/) provided in an AWS Quick Start to your AWS Account. The following workflow enables you to create and update a Kubernetes cluster using a manual workflow trigger.
69+
70+
```yaml
71+
name: cluster
72+
73+
on:
74+
workflow_dispatch:
75+
inputs:
76+
region:
77+
description: 'AWS Region'
78+
required: true
79+
default: 'eu-west-1'
80+
81+
jobs:
82+
amplify:
83+
name: Deploy stack to AWS
84+
runs-on: ubuntu-latest
85+
outputs:
86+
env-name: ${{ steps.env-name.outputs.environment }}
87+
steps:
88+
- name: Checkout
89+
uses: actions/checkout@v2
90+
91+
- name: Configure AWS credentials
92+
id: creds
93+
uses: aws-actions/configure-aws-credentials@v1
94+
with:
95+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
96+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
97+
aws-region: ${{ github.event.inputs.region}}
98+
99+
- name: Configure environment name
100+
id: env-name
101+
env:
102+
REPO: ${{ github.repository }}
103+
run: |
104+
ENVIRONMENT=`echo $REPO | tr "/" "-"`
105+
echo "Environment name: $ENVIRONMENT"
106+
echo "::set-output name=environment::$ENVIRONMENT"
107+
108+
- name: Deploy to EKS Cluster
109+
id: eks-cluster
110+
uses: aws-actions/aws-cloudformation-github-deploy@master
111+
with:
112+
name: ${{ steps.env-name.outputs.environment }}-cluster
113+
template: https://s3.amazonaws.com/aws-quickstart/quickstart-amazon-eks/templates/amazon-eks-master.template.yaml
114+
no-fail-on-empty-changeset: "1"
115+
parameter-overrides: >-
116+
AvailabilityZones=${{ github.event.inputs.region }}a,
117+
AvailabilityZones=${{ github.event.inputs.region }}c,
118+
KeyPairName=${{ github.event.inputs.keypair }},
119+
NumberOfAZs=2,
120+
ProvisionBastionHost=Disabled,
121+
EKSPublicAccessEndpoint=Enabled,
122+
EKSPrivateAccessEndpoint=Enabled,
123+
RemoteAccessCIDR=0.0.0.0/0
124+
125+
```
126+
66127
## License
67128

68129
[MIT](/LICENSE)

0 commit comments

Comments
 (0)