Skip to content

Instantly share code, notes, and snippets.

@sasaken555
Last active January 23, 2021 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasaken555/524337a57dffface0a21c229476cdc00 to your computer and use it in GitHub Desktop.
Save sasaken555/524337a57dffface0a21c229476cdc00 to your computer and use it in GitHub Desktop.
AWS Amplify application stack. Once pushed your source to CodeCommit, an application will be built and published!
AWSTemplateFormatVersion: "2010-09-09"
Description: Frontend application hosted by Amplify
Parameters:
AppName:
Type: String
Default: my-app
Description: Amplify application name
AppRolePolicyName:
Type: String
Default: AppRoleDefaultPolicy
Description: Amplify role policy name
AppBranchName:
Type: String
Default: master
Description: Amplify application Git branch name to deploy
Resources:
FrontAppRepository:
Type: AWS::CodeCommit::Repository
Properties:
RepositoryName:
Ref: AppName
RepositoryDescription: frontend application with your favorite framework.
FrontAppAmplifyRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: amplify.amazonaws.com
Version: "2012-10-17"
FrontAppAmplifyRolePolicy:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action: codecommit:GitPull
Effect: Allow
Resource: !GetAtt FrontAppAmplifyRole.Arn
Version: "2012-10-17"
PolicyName:
Ref: AppRolePolicyName
Roles:
- Ref: FrontAppAmplifyRole
FrontAppAmplifyApp:
Type: AWS::Amplify::App
Properties:
Name:
Ref: AppName
IAMServiceRole:
Fn::GetAtt:
- FrontAppAmplifyRole
- Arn
Repository:
Fn::GetAtt:
- FrontAppRepository
- CloneUrlHttp
FrontAppAmplifyBranch:
Type: AWS::Amplify::Branch
Properties:
AppId:
Fn::GetAtt:
- FrontAppAmplifyApp
- AppId
BranchName:
Ref: AppBranchName
EnableAutoBuild: true
EnablePullRequestPreview: true
Outputs:
CloneUrl:
Description: Git clone URL with SSH
Value:
Fn::GetAtt:
- FrontAppRepository
- CloneUrlSsh
AmplifyAppId:
Description: Amplify application ID
Value:
Fn::GetAtt:
- FrontAppAmplifyApp
- AppId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment