Skip to content

Instantly share code, notes, and snippets.

@BielosX
Created September 4, 2022 18:39
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 BielosX/411fdb0f4c87f6177584c183993dfc8c to your computer and use it in GitHub Desktop.
Save BielosX/411fdb0f4c87f6177584c183993dfc8c to your computer and use it in GitHub Desktop.
AWS Beanstalk using CloudFormation
Parameters:
SolutionStackName:
Type: String
Resources:
DemoBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "demo-app-bucket-${AWS::Region}-${AWS::AccountId}"
AccessControl: "Private"
DemoApplication:
Type: AWS::ElasticBeanstalk::Application
Properties:
ApplicationName: "demo-app"
AppIamRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- ec2.amazonaws.com
Action:
- 'sts:AssumeRole'
ManagedPolicyArns:
- "arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier"
AppInstanceProfile:
Type: AWS::IAM::InstanceProfile
Properties:
Roles:
- !Ref AppIamRole
DemoEnv:
Type: AWS::ElasticBeanstalk::Environment
Properties:
ApplicationName: !Ref DemoApplication
EnvironmentName: "demo-app-env"
SolutionStackName: !Ref SolutionStackName
OptionSettings:
- Namespace: "aws:autoscaling:launchconfiguration"
OptionName: "InstanceType"
Value: "t3.micro"
- Namespace: "aws:autoscaling:launchconfiguration"
OptionName: "IamInstanceProfile"
Value: !Ref AppInstanceProfile
- Namespace: "aws:elasticbeanstalk:healthreporting:system"
OptionName: "SystemType"
Value: "enhanced"
- Namespace: "aws:elasticbeanstalk:cloudwatch:logs"
OptionName: "StreamLogs"
Value: true
- Namespace: "aws:elasticbeanstalk:cloudwatch:logs"
OptionName: "DeleteOnTerminate"
Value: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment