@@ -41,17 +41,16 @@ In this step, we download the Java Spring PetClinic Microservices from github.co
41
41
#Need to change to just grab it from the current project instead of the other folder.
42
42
43
43
mkdir /tmp/scratch && cd /tmp/scratch
44
- curl https://codeload.github.com/awslabs/amazon-ecs-java-microservices/zip/master -o amazon-ecs-java-microservices-master.zip
45
- #TOFIX: git clone <awslabs github repo of this project> instead?
46
- unzip amazon-ecs-java-microservices-master.zip
44
+ #TOFIX: git clone <awslabs github repo of this project>
47
45
48
46
```
49
47
50
48
#### Create 5 AWS CodeCommit Repositories for the microservices
51
49
``` bash
52
50
cd amazon-ecs-java-microservices-master/2_ECS_Java_Spring_PetClinic_Microservices
53
51
54
- for repo in spring-petclinic-rest-owner spring-petclinic-rest-pet spring-petclinic-rest-system spring-petclinic-rest-vet spring-petclinic-rest-visit
52
+ for repo in spring-petclinic-rest-owner spring-petclinic-rest-pet \
53
+ spring-petclinic-rest-system spring-petclinic-rest-vet spring-petclinic-rest-visit
55
54
do
56
55
export gitSSHUrl=$( aws codecommit create-repository --repository-name $repo | \
57
56
python -c " import sys, json; print json.load(sys.stdin)['repositoryMetadata']['cloneUrlSsh']" )
@@ -173,14 +172,16 @@ The above command will encrypt our database password using KMS key ```alias/aws/
173
172
Using AWS Console, navigate to Cloudformation console and launch the following Cloudformation template from your ``` $infra_bucket_name ``` bucket. Make sure you specific the same database password for the ``` DBPassword ``` parameter as the one in ``` /DeploymentConfig/Prod/DBPassword ``` .
174
173
175
174
``` bash
175
+
176
+ export mysshkey=< EC2 SSH Key>
177
+
176
178
aws cloudformation create-stack --stack-name petclinic-cicd --template-url \
177
179
https://s3-$region .amazonaws.com/$infra_bucket_name /master-ecs.yaml --parameters \
178
180
ParameterKey=CodeBuildContainerSpringBootDocker,ParameterValue=$account_id .dkr.ecr.$region .amazonaws.com/custombuild:latest \
179
181
ParameterKey=InfraAutomationCfnBucket,ParameterValue=$infra_bucket_name \
180
- ParameterKey=KeyPair,ParameterValue=< your sshkeypair> \
181
- ParameterKey=DBPassword,ParameterValue=\
182
- $( aws ssm get-parameters --name /DeploymentConfig/Prod/DBPassword --with-decryption --query Parameters[0].Value --region $region | sed -e ' s/\"//g' ) \
183
- ParameterKey=SsmKMSKeyArn,ParameterValue=< arn_of_alias/aws/ssm> \
182
+ ParameterKey=KeyPair,ParameterValue=$mysshkey \
183
+ ParameterKey=DBPassword,ParameterValue=$( aws ssm get-parameters --name /DeploymentConfig/Prod/DBPassword --with-decryption --query ' Parameters[0].Value' ) \
184
+ ParameterKey=SsmKMSKeyArn,ParameterValue=$( aws kms describe-key --key-id ' alias/aws/ssm' --query ' KeyMetadata.Arn' ) \
184
185
--capabilities CAPABILITY_IAM
185
186
186
187
```
@@ -248,15 +249,14 @@ To delete the AWS resources:
248
249
- Delete the 5 CodePipeline buckets (S3 console)
249
250
- Cloudformation cannot delete an S3 bucket that is not empty. We will delete the bucket manually using AWS Console or AWS CLI
250
251
```
251
- aws s3 rb s3://$infra_bucket_name --force
252
+ aws s3 rb s3://<infra-automation-bucket-name> --force
252
253
```
253
254
- Delete the snapshot of RDS (RDS console -> snapshot)
254
255
- Delete CodeCommit Repositories
255
256
256
257
257
258
``` bash
258
- for repo in spring-petclinic-rest-owner spring-petclinic-rest-pet spring-petclinic-rest-system \
259
- spring-petclinic-rest-vet spring-petclinic-rest-visit
259
+ for repo in spring-petclinic-rest-owner spring-petclinic-rest-pet spring-petclinic-rest-system spring-petclinic-rest-vet spring-petclinic-rest-visit
260
260
do
261
261
aws codecommit delete-repository --repository-name $repo
262
262
done
0 commit comments