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
CodeBuildProject: | |
Type: AWS::CodeBuild::Project | |
Properties: | |
Artifacts: | |
Type: CODEPIPELINE | |
Source: | |
Type: CODEPIPELINE | |
BuildSpec: | | |
version: 0.2 | |
phases: |
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
Resources: | |
CodeRepository: | |
Type: AWS::CodeCommit::Repository | |
Properties: | |
RepositoryName: !Ref AWS::StackName | |
Outputs: | |
CloneUrlHttp: | |
Value: !GetAtt CodeRepository.CloneUrlHttp |
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
--- | |
AWSTemplateFormatVersion: 2010-09-09 | |
Parameters: | |
RepositoryBranch: | |
Type: String | |
Default: master | |
Cluster: |
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
AlarmTopic: | |
Type: AWS::SNS::Topic | |
Properties: | |
Subscription: | |
- Endpoint: [email protected] | |
Protocol: email | |
CPUAlarmHigh: | |
Type: AWS::CloudWatch::Alarm | |
Properties: |
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
# The worker containers simply execute the Laravel artisan queue:work | |
# command instead of php-fpm | |
TaskDefinitionWorker: | |
Type: AWS::ECS::TaskDefinition | |
Properties: | |
Family: laravel-workers | |
ContainerDefinitions: | |
- Name: app | |
Essential: true | |
Image: !Join [ ".", [ !Ref "AWS::AccountId", "dkr.ecr", !Ref "AWS::Region", !Join [ ":", [ !Join [ "/", [ "amazonaws.com", !Ref ECR ] ], "laravel" ] ] ] ] |
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
# That's all it takes to create a queue in CloudFormation | |
# CloudFormation will assign a unique name to it, that we | |
# will pass to our Laravel containers | |
Queue: | |
Type: AWS::SQS::Queue | |
# Then in the web.yaml stack, we update our ECSRole to grant | |
# our ECS instances access to this one queue we just created | |
- PolicyName: sqs-read-write-access | |
PolicyDocument: |
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
ScaleUpPolicy: | |
Type: AWS::AutoScaling::ScalingPolicy | |
Properties: | |
AdjustmentType: ChangeInCapacity | |
AutoScalingGroupName: | |
Ref: asGroup | |
Cooldown: '1' | |
ScalingAdjustment: '1' | |
CPUAlarmHigh: |
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
aws cloudformation delete-stack --stack-name=laravelaws |
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
# Create your CloudFormation stack from scratch using the create-stack command | |
aws cloudformation create-stack | |
--stack-name=laravel | |
--template-body=file://master.yaml | |
--capabilities CAPABILITY_NAMED_IAM | |
--parameters | |
ParameterKey=CloudFrontOAI,ParameterValue=origin-access-identity/cloudfront/YOUR_CF_OAI_HERE | |
ParameterKey=CertificateArnCF,ParameterValue=arn:aws:acm:us-east-1:your_cloudfront_certificate_arn_here | |
ParameterKey=CertificateArn,ParameterValue=arn:aws:acm:us-east-1:your_certificate_arn_here | |
ParameterKey=BaseUrl,ParameterValue=laravelaws.com |
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
StackAlarmTopic: | |
Type: AWS::SNS::Topic | |
Properties: | |
DisplayName: Stack Alarm Topic | |
DatabasePrimaryCPUAlarm: | |
Type: AWS::CloudWatch::Alarm | |
Properties: | |
AlarmDescription: Primary database CPU utilization is over 80%. | |
Namespace: AWS/RDS |