cd src/HelloFargate/; zip -r "../HelloFargate.zip" *; cd ../..
Create an init file with cli
aws codestar create-project --generate-cli-skeleton |jq .
{
"name": "",
"id": "",
"description": "",
"clientRequestToken": "",
"sourceCode": [
{
"source": {
"s3": {
"bucketName": "",
"bucketKey": ""
}
},
"destination": {
"codeCommit": {
"name": ""
},
"gitHub": {
"name": "",
"description": "",
"type": "",
"owner": "",
"privateRepository": true,
"issuesEnabled": true,
"token": ""
}
}
}
],
"toolchain": {
"source": {
"s3": {
"bucketName": "",
"bucketKey": ""
}
},
"roleArn": "",
"stackParameters": {
"KeyName": ""
}
},
"tags": {
"KeyName": ""
}
}
Modify init template to suit your needs (note that you'll use github or codecommit for the sourcecode. You may remove other paramaters as needed eg clientRequestToken):
cat /tmp/init-template.json
{
"name": "YoFargate",
"id": "yofargate",
"description": "Make Applications Great Again",
"sourceCode": [
{
"source": {
"s3": {
"bucketName": "yourcodestarsourcebucket",
"bucketKey": "templates/codestar/src/HelloFargate.zip"
}
},
"destination": {
"codeCommit": {
"name": "yofargate"
}
}
}
],
"toolchain": {
"source": {
"s3": {
"bucketName": "yourcodestarsourcebucket",
"bucketKey": "templates/codestar/toolchain.json"
}
},
"roleArn": "yourcodestarservicerolearn",
"stackParameters": {
"ProjectId": "yofargate"
}
},
"tags": {
"Application": "yofargate"
}
}
Create your new codestar project
aws codestar create-project --cli-input-json file:///tmp/init-template.json
Hint: if you get this error:
An error occurred (AccessDeniedException) when calling the CreateProject operation: Cross-account pass role is not allowed.
check the init template and make sure the toolchain roleArn exists and is correct (account number?)
modify toolchain cft template and then updating the toolchain stack with cli:
aws cloudformation deploy --stack-name codestar-toolchain-test --template-file toolchain.json --parameter-overrides ProjectId=shalomfargate --tags Application=shalomfargate [email protected] Environment=Test Source=`git remote -v |grep fetch | awk '{print $2}'` --capabilities CAPABILITY_NAMED_IAM
Must be stored in s3 so make an s3 available to your accounts. upload toolchain.json (diff names if you want diff toolchains) and a source object, cf cli tutorial
This sample toolchain creates a pipeline that builds an application. It includes a general purpose build environment that can synthesize cloudformation from cdk and evaluate the resulting cloud formation templates with cfn nag. It follows a pattern of build, test, create change set and finally deploy change set.
Toolchain contains several iam resources attached to codepipeline stages. They need to be configured to have the permissions needed to build whatever is being built by codepipeline stages. Note the permission boundaries confine resources to awscodestar-$ProjectId*.
This is the source for the application. src directory contains a sample app using fargate deployed from cloduformation generated by cdk.
delete stacks created by toolchain pipeline delete toolchain artifact bucket delete toolchain stack