AWS Notes
4.74K subscribers
228 photos
30 videos
10 files
2.41K links
AWS Notes — Amazon Web Services Educational and Information Channel

Chat: https://t.me/aws_notes_chat

Contacts: @apple_rom, https://www.linkedin.com/in/roman-siewko/
Download Telegram
​​Создание AWS аккаунтов через CloudFormation: 🎉

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Organizations.html

Не прошло и... эээ... 6... Что ж, лучше поздно, чем никогда.

Type: AWS::Organizations::Account
Properties:
AccountName: String
Email: String
ParentIds:
- String
RoleName: String
Tags:
- Tag

⚠️ Important
▪️ If you include multiple accounts in a single template, you must use the DependsOn attribute on each account resource type so that the accounts are created sequentially. If you create multiple accounts at the same time, Organizations returns an error and the stack operation fails.
▪️ You can't modify the following list of Account resource parameters using CloudFormation updates.
▫️ AccountName
▫️ Email
▫️ RoleName

#CloudFormation #Organizations
​​Cfnctl — Terraform cli experience for AWS Cloudformation

https://github.com/rogerwelin/cfnctl

With cfnctl, you write Cloudformation templates as usual but use the cli workflow that you are already used to from Terraform, including:

▪️ apply
▪️ plan
▪️ destroy
▪️ output
▪️ validate
▪️ version

#CloudFormation
​​cfn-teleport

A command-line tool which can move CloudFormation resources between stacks.

https://github.com/udondan/cfn-teleport

cfn-teleport --source Stack1 --target Stack2 --resource Bucket21D68F7E8 --resource Bucket182C536A1 --yes

#CloudFormation
​​Вдруг вы не заметили в AWS IAM Actions есть Generator:

https://www.awsiamactions.io/generator

В нём можно не только собрать нужную конструкцию политик в JSON, но и сразу же конвертировать это в Terraform и CloudFormation.

#IAM #Terraform #CloudFormation
​​CloudFormation team is running a survey to learn more about your perception of CloudFormation performance, with the goal of helping to improve the customer experience.

📢 Take the survey at:

https://amazonmr.au1.qualtrics.com/jfe/form/SV_2lwFTzuDD4aZL0i

#CloudFormation
​​Loops in CloudFormation: !ForEach 💪

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-foreach.html

AWSTemplateFormatVersion: 2010-09-09
Transform: 'AWS::LanguageExtensions'
Resources:
'Fn::ForEach::Tables':
- TableName
- [Points, Score, Name, Leaderboard]
- 'DynamoDB${TableName}':
Type: 'AWS::DynamoDB::Table'
Properties:
TableName: !Ref TableName
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: '5'
WriteCapacityUnits: '5'

Fn::ForEach can be used in the sections:

▫️ Resource
▪️ Resource properties
▫️ Conditions
▫️ Outputs

Fn::ForEach parameters

Identifier (String) → Identifier is used to refer to the current element we’re iterating over within the Collection (Array of Strings).

Collection (Array of Strings) → Array of values that the Identifier can take.

OutputKey (String) → The key of the resulting key-value pair for the given element in the collection that will be merged to the parent object.

OutputValue (Any) → The value of the resulting key-value pair for the given element in the collection that will be merged to the parent object.

Note: the syntax of Fn::ForEach declaration has a suffix where the UniqueLoopName is used to identify the loop. This allows multiple Fn::ForEach function references to be declared on a given level.

#CloudFormation
🆕 CloudFormation + GitOps

https://aws.amazon.com/blogs/devops/automate-safe-aws-cloudformation-deployments-from-github/

With CloudFormation Git sync, you can manage your stacks with Git repository. The repository is monitored for changes to two files:

▫️ A CloudFormation template file that defines a stack
▫️ A stack deployment file that contains parameters that configure the stack

When you commit changes to the template or the deployment file, CloudFormation automatically updates the stack.

Supported:

GitHub
GitHub Enterprise
GitLab
Bitbucket

#CloudFormation
​​AWS infrastructure as code: A year in review

Исключительно полезное видео, рекомендуется всем, даже если вы всегда используете лишь Terraform.

https://www.youtube.com/watch?v=fROlLTMRi0Y

Здесь очень важно будет узнать про CloudFormation resource registry, который теперь является фундаментом работы всего AWS по части IaC, в том числе который уже совсем скоро станет основным и для Terraform.

Особенно полезным видео может быть Карену — отличный набор инсайтов для третьего издания Mastering AWS CloudFormation. 😀

#CloudFormation #reInvent
Вдруг вы не заметили, что CloudFormation стэки стали деплоиться на глаз заметно быстрей:

https://aws.amazon.com/blogs/devops/how-we-sped-up-aws-cloudformation-deployments-with-optimistic-stabilization/

Конечно не заметили — у нас ведь Terraform, ха-ха-ха. Это важный момент, т.к. много процессов под капотом запускает CloudFormation (например, AWS CDK, Control Tower и др.), так что это приведёт к общему ускорению работы AWS.

#CloudFormation
CloudFormation + FORCE_DELETE_STACK

Зависшие при удалении стэки можно принудительно убить:

aws cloudformation delete-stack --stack-name some-stack --deletion-mode FORCE_DELETE_STACK

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-cli-deleting-stack.html

Это сильно упрощает удаление стэков с бакетами, содержащими объекты.

#CloudFormation