AWS: mudanças entre as edições
| Linha 70: | Linha 70: | ||
* criar bucket (nome do bucket tem que ser a url) | * criar bucket (nome do bucket tem que ser a url) | ||
* ativar hospedagem de site (redirecionamento p/objeto - index.html) | |||
* colocar política base do bucket | |||
<code> | |||
{ | |||
"Version": "2012-10-17", | |||
"Statement": [ | |||
{ | |||
"Sid": "PublicReadGetObject", | |||
"Effect": "Allow", | |||
"Principal": "*", | |||
"Action": "s3:GetObject", | |||
"Resource": "arn:aws:s3:::endereco.site.com.br/*" | |||
} | |||
] | |||
} | |||
</code> | |||
= SES = | = SES = | ||
Edição das 18h41min de 27 de dezembro de 2022
EC2
Metadatas: http://169.25.169.254/latest/metadata
https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
Code Deploy
Instalar agente do CodeDeploy
sudo apt-get update
sudo apt install ruby-full
sudo apt install wget
cd /home/user/
wget https://bucket-name.s3.region-identifier.amazonaws.com/latest/install
wget https://aws-codedeploy-sa-east-1.s3.sa-east-1.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
- Verificar
sudo service codedeploy-agent status
sudo service codedeploy-agent start
Erro Code Deploy
The ApplicationStop hook is being called from the previously installed deployment before trying to run the current deployment appspec.yml file.
In order to prevent this from happening you'll have to remove any previously installed deployment from the server.
Stop the code deploy agent
sudo service codedeploy-agent stop
clear all deployments under
/opt/codedeploy-agent/deployment-root
Restart the code deploy agent
sudo service codedeploy-agent start
S3
Bucket site externo
- criar bucket (nome do bucket tem que ser a url)
- ativar hospedagem de site (redirecionamento p/objeto - index.html)
- colocar política base do bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::endereco.site.com.br/*"
}
]
}
SES
SES Template
aws ses create-template --generate-cli-skeleton > arquivo.json (gera um arquivo padrão)
aws ses create-template --cli-input-json file://file.json
aws ses detele-template --template-name MyTemplate
aws ses get-template --template-name MyTemplate
aws ses update-template --cli-input-json file://file.json
aws ses test-render-template --template-name MyTemplate --template-data {"nome":"nome_do_template"} --region sa-east-1
Envio em massa
- Criar SQS fifo
- Criar função lambda: atenção as permissões (SES,SQS)
- Ligar fila SQS a função lambda
- Enviar para a fila
Envio:
{"sendTo":"destino@provedor.com","TemplateData":"{\"var1\":\"valor1\",\"var2\":\"valor2\"}","Source":"naoresponda@dominio.com.br","Template":"nomedoTemplate"}