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
| Parameters: | |
| NameOfService: | |
| Description: "The name of the service this stack is to be used for." | |
| Type: String | |
| KeyName: | |
| Description: "Name of existing EC2 KeyPar to enable SSH access into the server" | |
| Type: AWS::EC2::KeyPair::KeyName | |
| Outputs: | |
| WebsiteURL: | |
| Description: Website URL for EC2 Instance |
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
| Properties: | |
| InstanceType: t2.micro | |
| SecurityGroups: | |
| - !Ref EC2SecurityGroup | |
| EC2SecurityGroup: | |
| Type: AWS::EC2::SecurityGroup | |
| Properties: | |
| GroupDescription: "Enable HTTP on 80" | |
| SecurityGroupIngress: | |
| - IpProtocol: tcp |
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
| Fn::Equals | |
| # Returns true if two values are equal else it will return false. | |
| - Syntax: Fn:Equals: [value_1, value_2] | |
| - short syntax: !Equals[value_1, value_2] | |
| Example: | |
| UserProdCondition: | |
| !Equals [!Ref EnvironmentType, prod] |
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
| Fn::And | |
| - Fn:::And acts as an AND operator | |
| - Minimum number of a condition is 2 | |
| - Maximum number of a condition is 10 | |
| - syntax: Fn:And: [condtion] |
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
| # list comprehension | |
| my_nums = (x*x for x in [1, 2, 3, 4, 5]) | |
| print my_nums | |
| for num in my_nums: | |
| print num |
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
| # list comprehension | |
| my_nums = [x*x for x in [1, 2, 3, 4, 5]] | |
| print my_nums | |
| for num in my_nums: | |
| print num |
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
| def square_numbers(nums): | |
| for i in nums: | |
| yield(i*i) | |
| my_nums = square_numbers([1, 2, 3, 4, 5]) | |
| for num in my_nums: | |
| print num |
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
| def square_numbers(nums): | |
| for i in nums: | |
| yield(i*i) | |
| my_nums = square_numbers([1, 2, 3, 4, 5]) | |
| print next(my_nums) | |
| print next(my_nums) | |
| print next(my_nums) | |
| print next(my_nums) |
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
| def square_numbers(nums): | |
| for i in nums: | |
| yield(i*i) | |
| my_nums = square_numbers([1, 2, 3, 4, 5]) | |
| print next(my_nums) |
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
| def square_numbers(nums): | |
| for i in nums: | |
| yield(i*i) | |
| my_nums = square_numbers([1, 2, 3, 4, 5]) | |
| print my_nums |